# -*- coding: utf-8 -*-
from common import orm
from common.utils.types import Enum

BANKCARD_STATUS = Enum({
    "DISABLE": (0L, u"禁用"),
    "ENABLE": (1L, u"启用"),
})

BANKCARD_TYPE = Enum({
    "RECHARGE": (0L, u"充值"),
    "PAYMENT": (1L, u"付款"),
    "BUFFER": (2L, u"中转"),
})

ISSTATS_TYPE = Enum({
    "NOTSTATS": (0L, u"非汇总"),
    "STATS": (1L, u"汇总"),
})


class BankCard(orm.Model):
    """
    收款 银行卡信息
    """
    __tablename__ = "bankcard"
    id = orm.Column(orm.Integer, primary_key=True, autoincrement=True)
    type = orm.Column(orm.Integer, default=0)
    name = orm.Column(orm.VARCHAR)
    mch_id = orm.Column(orm.Integer)
    account_number = orm.Column(orm.VARCHAR)  # 卡号
    account_holder = orm.Column(orm.VARCHAR)  # 持卡人姓名
    bank = orm.Column(orm.VARCHAR)  # 银行名称
    bank_en = orm.Column(orm.VARCHAR)  # 银行名称
    status = orm.Column(orm.Integer, default=0)
    phone = orm.Column(orm.VARCHAR)
    usheild_date = orm.Column(orm.DATETIME)
    subbranch = orm.Column(orm.VARCHAR)  # 支行名称
    account = orm.Column(orm.VARCHAR)  # 支行名称
    password = orm.Column(orm.VARCHAR)  # 支行名称
    pay_password = orm.Column(orm.VARCHAR)  # 支行名称
    ukey_password = orm.Column(orm.VARCHAR)  # 支行名称
    balance = orm.Column(orm.FLOAT, default=0)
    desc = orm.Column(orm.VARCHAR)
    daily_recharge_limit = orm.Column(orm.FLOAT)
    weight = orm.Column(orm.Integer, default=10)
    created_at = orm.Column(orm.DATETIME)
    updated_at = orm.Column(orm.DATETIME)
    opening_time = orm.Column(orm.Integer, default=0)
    closing_time = orm.Column(orm.Integer, default=0)
    withdraw_selected_at = orm.Column(orm.DATETIME)
    min_withdraw_order = orm.Column(orm.Integer)
    max_withdraw_order = orm.Column(orm.Integer)
    min_balance_limit = orm.Column(orm.Integer)
    max_balance_limit = orm.Column(orm.Integer)
    alipay_id = orm.Column(orm.VARCHAR)
    alipay_bank_name = orm.Column(orm.VARCHAR)
    alipay_bank_short_name = orm.Column(orm.VARCHAR)
    pay_type = orm.Column(orm.VARCHAR)
    max_cash_flow = orm.Column(orm.Integer)
